{include file="header.htm" /}
<link href="__SKIN__/css/main.css?v={$version}" rel="stylesheet" type="text/css">
<link href="__SKIN__/css/page.css?v={$version}" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__SKIN__/js/clipboard.min.js"></script>
<style type="text/css">
    .footer-oper .dataTables_paginate .pagination {float: right;}
</style>
<body class="bodystyle" style="cursor: default; -moz-user-select: inherit; min-width:400px;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page" style="min-width: 400px;">
    {empty name="$dealer_id"}{include file="bar.htm" /}{/empty}
    <div class="flexigrid flexigrid-xin">
        <div class="header-bar">
            <div class="more">
                <div class="search">
                    <div class="content">
                        <form id="searchForm" action="{:weapp_url('DealerPlugin/DealerPlugin/dealer_order')}" method="get" onsubmit="layer_loading('正在处理');" style="display: unset;">
                            {$searchform.hidden|default=''}
                            <input type="hidden" name="dealer_id" value="{$Request.param.dealer_id}">
                            <div class="ey-form-item"><label class="users-form-item-label">关键词：</label>
                                <div class="users-form-item-content">
                                    <div class="users-select">
                                        <div tabindex="0" class="users-select-selection">
                                            <!-- 订单号查询 -->
                                            <div class="sDiv2">
                                                <input type="text" size="50" name="order_code" id="order_code" value="{$Request.param.order_code}" class="qsbox" style="width: 170px;" placeholder="订单号或商品名称...">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="ey-form-item"><label class="users-form-item-label">结算状态：</label>
                                <div class="users-form-item-content">
                                    <div class="users-select">
                                        <div tabindex="0" class="users-select-selection">
                                            <div class="">
                                                <select name="handle_rebate" id="handle_rebate">
                                                    <option value="" {if condition="!$Request.param.handle_rebate"}selected{/if}>全部</option>
                                                    <option value="1" {eq name="$Request.param.handle_rebate" value="1"}selected{/eq}>已结算</option>
                                                    <option value="9" {eq name="$Request.param.handle_rebate" value="9"}selected{/eq}>未结算</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="ey-form-item"><label class="users-form-item-label">下单时间：</label>
                                <div class="users-form-item-content">
                                    <div class="users-select">
                                        <div tabindex="0" class="users-select-selection">
                                            <div class="sDiv2">
                                                <input type="text" name="add_time_begin" id="add_time_begin" autocomplete="off" value="{$Request.param.add_time_begin}" class="qsbox" placeholder="起始日期">
                                            </div>
                                            &nbsp;至&nbsp;
                                            <div class="sDiv2">
                                                <input type="text" name="add_time_end" id="add_time_end" autocomplete="off" value="{$Request.param.add_time_end}" class="qsbox" placeholder="结束日期">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <div class="ey-form-item" style="margin-left: 20px;">
                            <div class="users-form-item-content">
                                <span class="bt-xin" onclick="orderQuery();">查询</span>
                                <span class="bt-xin-no" onclick="orderQuery('reset');">重置</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="flexigrid flexigrid-xin" style="padding-top: 20px;">
        <div class="tableDiv  bubbleInfo">
            <table cellspacing="0" cellpadding="0" style="width: 100%;">
                <thead>
                    <tr>
                        <th> <div class="">商品信息</div> </th>
                        <th class="w240"> <div class="">单价/数量</div> </th>
                        <th class="w240"> <div class="">买家/收货人</div> </th>
                        <th class="w140"> <div class="">订单状态</div> </th>
                        <th class="w310"> <div class="">分佣信息</div> </th>
                        <th class="w140"> <div class="">结算状态</div> </th>
                    </tr>
                </thead>
                <tbody>
                    {empty name="list"}
                        <tr>
                            <td class="no-data" align="center" axis="col0" colspan="50">
                                <div class="">
                                    <div class="no_pic"><img src="__SKIN__/images/null-data.png"></div>
                                </div>
                            </td>
                        </tr>
                    {else/}
                        {volist name="list" id="vo"}
                            <tr class="order-empty"><td colspan="7"></td></tr>
                            <tr>
                                <td class="biaotou" colspan="7">
                                    <span class="mr15">
                                        <span class="mr15">订单号：{$vo.order_code} <a class="copy order_code" onclick="orderCopy();" data-clipboard-text="{$vo.order_code}"><i class="iconfont e-fuzhi basics-color" title="点击复制"></i></a></span>
                                        {eq name="$vo.order_source" value="30"}<span class="mr15" style="position: relative;"><i class="iconfont e-jifen" title="积分商城订单"></i></span>{/eq}
                                        <span class="fr"><i class="iconfont e-shijian mr5"></i>{$vo.add_time}</span>
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                {volist name="$vo.Details" id="do"}
                                    {eq name="$i" value="1"}
                                    <td>
                                        <div class="goods-detail">
                                            <div class="goods-image"> <a><img src="{$do.litpic}"></a> </div>
                                            <div class="goods-info">
                                                <p class="goods-title">{$do.product_name}</p>
                                                <p class="goods-spec">{$do.product_spec}</p>
                                                {if condition="!empty($do.apply_service) && !empty($do.service_id)"}
                                                <p class="after-sale"><a href="{:url('ShopService/after_service_details', array('service_id' => $do['service_id'], 'backurl'=>url('ShopService/after_service')))}" title="点击查看详情"><span>{$do.status_name}</span></a></p>
                                                {/if}
                                            </div>
                                        </div>
                                    </td>
                                    <td class=""><p>￥{$do.product_price} x {$do.num}</p></td>
                                    {/eq}
                                {/volist}
                            
                                <td class="" rowspan="{$vo.rowspan}">
                                    <div class="w220 p0">
                                        <p><a class="basics-color" href="javascript:void(0);" data-href="{:url('Member/users_edit', ['id'=>$vo.users_id,'from'=>'money_index','iframe'=>1])}" onclick="openFullframe(this, '会员资料','100%','100%');">{$vo.u_nickname}</a></p>
                                        {eq name="$vo.prom_type" value="0"}
                                        <p>{$vo.consignee}&nbsp;&nbsp;{$vo.mobile}</p>
                                        {else/}
                                        <p>{$vo.u_nickname}&nbsp;&nbsp;{$vo.u_mobile}</p>
                                        {/eq}
                                        <!-- <p class="ellipsis">{$vo.all_address|msubstr=###,0,16,true}<a class="copy address_code curpoin" onclick="addressCopy();" data-clipboard-text="{$vo.province}-{$vo.city}-{$vo.district}-{$vo.address}，收货人：{$vo.consignee}，手机号：{$vo.mobile}"><i class="iconfont e-fuzhi ml5 basics-color" title="点击复制"></i></a></p> -->
                                    </div>
                                </td>

                                <td class="" rowspan="{$vo.rowspan}">
                                    <p>
                                        <span class="{eq name='$vo.order_status' value='0'}show{else/}none{/eq}">待付款</span>
                                        <span class="{eq name='$vo.order_status' value='1'}show{else/}none{/eq}">待发货</span>
                                        <span class="{eq name='$vo.order_status' value='2'}show{else/}none{/eq}">已发货</span>
                                        <span class="{eq name='$vo.order_status' value='3'}show{else/}none{/eq}">已完成</span>
                                        <span class="{if condition='4 == $vo.order_status'}show{else/}none{/if}">已过期</span>
                                        <span class="{if condition='-1 == $vo.order_status'}show{else/}none{/if}">已关闭</span>
                                    </p>
                                </td>
                                <td rowspan="{$vo.rowspan}">
                                    <div class="p0">
                                        <p>计算佣金总额：￥{$vo.dealer_total_amount}</p>
                                        <p>一级分佣：{$vo.parent_dealer_name} ￥{$vo.order_one_rebate} ({$vo.one_level_rebate}%)</p>
                                        <p {empty name='$vo.order_two_rebate'} style="display: none;" {else/} style="display: flex;" {/empty}>二级分佣：{$vo.top_dealer_name} ￥{$vo.order_two_rebate} ({$vo.two_level_rebate}%)</p>
                                    </div>
                                </td>
                                <td class="" rowspan="{$vo.rowspan}">
                                    <p>
                                        <span class="zt {eq name='$vo.handle_rebate' value='0'}show{else/}none{/eq}" style="color: #ff1f2c">未结算</span>
                                        <span class="zt {eq name='$vo.handle_rebate' value='1'}show{else/}none{/eq}" style="color: #19be6b;">已结算</span>
                                    </p>
                                </td>
                            </tr>
                            {volist name="$vo.Details" id="do"}
                                {gt name="$i" value="1"}
                                <tr>
                                    <td>
                                        <div class="goods-detail">
                                            <div class="goods-image"> <a><img src="{$do.litpic}"></a> </div>
                                            <div class="goods-info">
                                                <p class="goods-title">{$do.product_name}</p>
                                                <p class="goods-spec">{$do.product_spec}</p>
                                                {if condition="!empty($do.apply_service) && !empty($do.service_id)"}
                                                <p class="after-sale"><a href="{:url('ShopService/after_service_details', array('service_id' => $do['service_id'], 'backurl'=>url('ShopService/after_service')))}" title="点击查看详情"><span>{$do.status_name}</span></a></p>
                                                {/if}
                                            </div>
                                        </div>
                                    </td>
                                    <td class=""><p>￥{$do.product_price} x {$do.num}</p></td>
                                </tr>
                                {/gt}
                            {/volist}
                        {/volist}
                    {/empty}
                </tbody>
            </table>
        </div>
        <div class="footer-oper">
            {$page}
            <div style="clear:both"></div>
        </div>
    </div>
</div>

<script type="text/javascript">
    layui.use('laydate', function() {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#add_time_begin' //指定元素
        });
        laydate.render({
            elem: '#add_time_end' //指定元素
        });
    });

    // 地址信息复制
    function addressCopy() {
        var clipboard1 = new Clipboard(".address_code");
        clipboard1.on("success", function(e) {
            layer.msg("复制成功");
        });
        clipboard1.on("error", function(e) {
            layer.msg("复制失败！请手动复制", {icon: 5});
        }); 
    }

    // 订单号复制
    function orderCopy() {
        var clipboard1 = new Clipboard(".order_code");
        clipboard1.on("success", function(e) {
            layer.msg("复制成功");
        });
        clipboard1.on("error", function(e) {
            layer.msg("复制失败！请手动复制", {icon: 5});
        }); 
    }

    // 订单查询
    $(document).keydown(function(event) {
        if (event.keyCode == 13) {
            $('#searchForm input[type=text]').each(function(index, item) {
                if ($(item).is(':focus')) orderQuery();
            });
        }
    });

    function orderQuery(isReset) {
        if (isReset && 'reset' == isReset) {
            window.location.href = "{:weapp_url('DealerPlugin/DealerPlugin/dealer_order')}";
        } else {
            $('#searchForm').submit();
        }
    }
</script>

{include file="footer.htm" /}